#include <iostream>
using namespace std;

void Exchange(int arr[], int a, int b)
{
	int temp = arr[a];
	arr[a] = arr[b];
	arr[b] = temp;
}

void DealPivot(int arr[], int left, int right)
{
	int mid = (left+right)/2;
	if(arr[left] > arr[mid])
	{
		Exchange(arr, left, mid);
	}
	if(arr[left] > arr[right])
	{
		Exchange(arr, left, right);
	}
	if(arr[mid] > arr[right])
	{
		Exchange(arr, left, right);
	}
	Exchange(arr, right-1, mid);
}

void QuickSort(int arr[], int left, int right)
{
	if(left < right)
	{
		DealPivot(arr, left, right);
		int pivot = right - 1;
		int i = left;
		int j = right -1;
		
		while(true)
		{
			while(arr[++i] > arr[pivot])
			{
			}
			while(j > left && arr[--j] > arr[pivot])
			{
			}
			if(i < j)
			{
				Exchange(arr, i, j);
			}
			else
			{
				break;	
			} 
		}
		if(i < right)
		{
			Exchange(arr, i, right -1);
		}
		QuickSort(arr, left, i-1);
		QuickSort(arr, i+1, right);
	}
}

int main()
{
	int n;
	cin >> n;
	int *arr = new int[n];
	for(int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	
	QuickSort(arr, 0, n-1);
	
	for(int i = 0; i < n; i++)
	{
		cout << arr[i] << " ";
	}
	return 0;
}
